package hua.mtreader.feature.bookshelf.adapter;

import android.support.v7.widget.RecyclerView;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import hua.mtreader.R;

/**
 * Created by Administrator on 2017/3/15.
 */

public class ListBookAdapter extends RecyclerView.Adapter<ListBookAdapter.ViewHolder> {


    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        // View inflate = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_bookshelf_list, parent, false);
        View inflate = View.inflate(parent.getContext(), R.layout.item_bookshelf_list, null);
        return new ViewHolder(inflate);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.tvName.setText("position = " + position);

    }

    @Override
    public int getItemCount() {
        return 100;
    }

    static class ViewHolder extends RecyclerView.ViewHolder {

        TextView tvName;

        public ViewHolder(View itemView) {
            super(itemView);
            tvName = (TextView) itemView.findViewById(R.id.tv_name);
        }
    }


}
